home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIPermissionManager.idl < prev    next >
Text File  |  2006-05-08  |  6KB  |  144 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. /**
  39.  * This file contains an interface to the Permission Manager,
  40.  * used to persistenly store permissions for different object types (cookies, 
  41.  * images etc) on a site-by-site basis.
  42.  *
  43.  * This service broadcasts the following notification when the permission list
  44.  * is changed:
  45.  *
  46.  * topic  : "perm-changed" (PERM_CHANGE_NOTIFICATION)
  47.  *          broadcast whenever the permission list changes in some way. there
  48.  *          are four possible data strings for this notification; one
  49.  *          notification will be broadcast for each change, and will involve
  50.  *          a single permission.
  51.  * subject: an nsIPermission interface pointer representing the permission object
  52.  *          that changed.
  53.  * data   : "deleted"
  54.  *          a permission was deleted. the subject is the deleted permission.
  55.  *          "added"
  56.  *          a permission was added. the subject is the added permission.
  57.  *          "changed"
  58.  *          a permission was changed. the subject is the new permission.
  59.  *          "cleared"
  60.  *          the entire permission list was cleared. the subject is null.
  61.  */
  62.  
  63. #include "nsISupports.idl"
  64. #include "nsISimpleEnumerator.idl"
  65.  
  66. interface nsIURI;
  67. interface nsIObserver;
  68.  
  69. [scriptable, uuid(4F6B5E00-0C36-11d5-A535-0010A401EB10)]
  70. interface nsIPermissionManager : nsISupports
  71. {
  72.   /**
  73.    * Predefined return values for the testPermission method and for
  74.    * the permission param of the add method
  75.    */
  76.   const PRUint32 UNKNOWN_ACTION = 0;
  77.   const PRUint32 ALLOW_ACTION = 1;
  78.   const PRUint32 DENY_ACTION = 2;
  79.  
  80.   /**
  81.    * Add permission information for a given URI and permission type. This
  82.    * operation will cause the type string to be registered if it does not
  83.    * currently exist.
  84.    *
  85.    * @param uri         the uri to add the permission for
  86.    * @param type        a case-sensitive ASCII string, identifying the consumer.
  87.    *                    Consumers should choose this string to be unique, with
  88.    *                    respect to other consumers. The number of unique type
  89.    *                    indentifiers may be limited.
  90.    * @param permission  an integer from 1 to 15, representing the desired
  91.    *                    action (e.g. allow or deny). The interpretation of
  92.    *                    this number is up to the consumer, and may represent
  93.    *                    different actions for different types. Consumers may
  94.    *                    use one of the enumerated permission actions defined
  95.    *                    above. 0 is reserved for UNKNOWN_ACTION, and shouldn't
  96.    *                    be used.
  97.    * @throws            NS_ERROR_FAILURE if there is no more room for adding
  98.    *                    a new type
  99.    */
  100.   void add(in nsIURI uri,
  101.            in string type,
  102.            in PRUint32 permission);
  103.  
  104.   /**
  105.    * Remove permission information for a given URI and permission type.
  106.    * Note that this method takes a host string, not an nsIURI.
  107.    *
  108.    * @param host   the host to remove the permission for
  109.    * @param type   a case-sensitive ASCII string, identifying the consumer. 
  110.    *               The type must have been previously registered using the
  111.    *               add() method.
  112.    */
  113.   void remove(in AUTF8String host,
  114.               in string type);
  115.  
  116.   /**
  117.    * Clear permission information for all websites.
  118.    */
  119.   void removeAll();
  120.  
  121.   /**
  122.    * Test whether a website has permission to perform the given action.
  123.    * @param uri     the uri to be tested
  124.    * @param type    a case-sensitive ASCII string, identifying the consumer
  125.    * @param return  see add(), param permission. returns UNKNOWN_ACTION when
  126.    *                there is no stored permission for this uri and / or type.
  127.    */
  128.   PRUint32 testPermission(in nsIURI uri,
  129.                           in string type);
  130.  
  131.   /**
  132.    * Allows enumeration of all stored permissions
  133.    * @return an nsISimpleEnumerator interface that allows access to
  134.    *         nsIPermission objects
  135.    */
  136.   readonly attribute nsISimpleEnumerator enumerator;
  137. };
  138.  
  139. %{ C++
  140. #define NS_PERMISSIONMANAGER_CONTRACTID "@mozilla.org/permissionmanager;1"
  141.  
  142. #define PERM_CHANGE_NOTIFICATION "perm-changed"
  143. %}
  144.